# -*- coding: utf-8 -*-

from django import forms
from django.conf import settings
from exams.models import SubjectYear, SubjectProgram
from django.db import models
from core.models import Program, ProgramModule
from student.models import EnrollmentSheet

class SubjectSuccessSelection(forms.Form):
  subject = forms.ModelChoiceField(queryset = None, label = "Predmet", required = True)
  fromDate = forms.DateField(label = 'Začetni datum')
  toDate = forms.DateField(label = 'Končni datum')

class TransienceParamsSelection(forms.Form):

  choices_enrollment_type = [('0', 'Ne glede')]
  for i in settings.ENROLLMENT_TYPES:
    choices_enrollment_type.append(i)
    
  academic_year = forms.ChoiceField(choices = EnrollmentSheet.get_all_years(False), label = "Študijsko leto")      
  student_year = forms.ChoiceField(choices = settings.STUDENT_YEARS, label = "Letnik")
  student_program = forms.ModelChoiceField(queryset=Program.objects.filter(inactive = False), empty_label="Ne glede", label="Študijski program",required=False)
  study_type = forms.ChoiceField(choices = settings.STUDY_OPTIONS, label = "Način študija")
  enrollment_type = forms.ChoiceField(choices = choices_enrollment_type, label = "Vrsta vpisa")

  
class StudentsSchoolYearSelection(forms.Form):
  academic_year = forms.ChoiceField(choices = EnrollmentSheet.get_all_years(True), label = "Študijsko leto")
  
  choices_school_year = [('0','Ne glede')]
  for i in settings.STUDENT_YEARS:
    choices_school_year.append(i)
  school_year = forms.ChoiceField(choices = choices_school_year, label = "Letnik študija")
  
  choices_study_program = [('0', 'Ne glede')]
  queryset_programs = SubjectProgram.objects.all().order_by('program', 'course_group')
  temp = queryset_programs[0]
  choices_study_program.append((temp.pk, temp))
  for i in queryset_programs:
    if temp.program != i.program or temp.course_group != i.course_group:
      temp = i
      choices_study_program.append((temp.pk, temp))
    
  study_program = forms.ChoiceField(choices = choices_study_program, label = "Študijski program")
  
  
  choices_module = [('0', 'Ne glede')]
  program_module = ProgramModule.objects.all()
  for i in program_module:
    choices_module.append((i, i))
  module = forms.ChoiceField(choices = choices_module, label = "Smer/modul")
  
  
  choices_enrollment_type = [('0', 'Ne glede')]
  for i in settings.ENROLLMENT_TYPES:
    choices_enrollment_type.append(i)
  enrollment_type = forms.ChoiceField(choices = choices_enrollment_type, label = "Vrsta vpisa")
  
  
  choices_study_type = [
    ('0','Ne glede'),
    ('1', 'Redni vpis'),
    ('2', 'Izredni vpis')
  ]
  study_type = forms.ChoiceField(choices = choices_study_type, label = "Način študija")
  
  duplicates = forms.BooleanField(label = 'Izpis duplikatov', required = False)
  